package main

import "fmt"

func main()  {
	//声明字符串变量
	var str string
	//赋值
	str = "abc"
	fmt.Println("str = ", str)

	//自动推到类型
	str1 := "ccc"
	fmt.Println("str1 = ", str1)
	fmt.Printf("str1 type is %T\n", str1)

	//内建函数len()获取字符串的长度
	str2 := "bbb"
	fmt.Println("bbb length = ", len(str2))

	//获取单个字符串
	str3 := "hello go"
	fmt.Printf("str3[0] = %c, str3[1] = %c\n", str3[0], str3[1])
}
